package com.it.you.base.map;

import com.sun.tools.javac.util.List;
import lombok.Data;

@Data
public class NodeTest1 {
    private String name;
    private NodeTest1 next;

    public void setNext(String name, NodeTest1 next){
        next.setName(name);
        this.next = next;
    }

    @Override
    public String toString() {
        return "NodeTest1{" +
                "name='" + name + '\'' +
                ", next=" + next +
                '}';
    }

    public static void main(String[] args) {
        NodeTest1 rootNode = new NodeTest1();
        rootNode.setName("yeye");
        for (String s : List.of("baba", "erzi", "sunzi")) {
            NodeTest1 next = new NodeTest1();
            rootNode.setNext(s,next);
        }
        System.out.println(rootNode);
    }


}
